#include <stdio.h>

// 判断是否为闰年
int isLeapYear(int year) {
    return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}

// 计算从1990年到指定年份的总天数
int daysFrom1990ToYear(int year) {
    int sum = 0;
    for (int i = 1990; i < year; i++) {
        sum += isLeapYear(i) ? 366 : 365;
    }
    return sum;
}

// 计算指定年份指定月份之前的总天数
int daysBeforeMonth(int year, int month) {
    int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int sum = 0;
    for (int i = 1; i < month; i++) {
        if (i == 2) {
            sum += 28 + isLeapYear(year);
        } else {
            sum += days[i];
        }
    }
    return sum;
}

// 打印指定日期是星期几
void printWeekday(int year, int month, int day) {
    int sum = daysFrom1990ToYear(year) + daysBeforeMonth(year, month) + day;
    int week = sum % 7;
    if (week != 0) {
        printf("%d年%d月%d日是星期%d\n", year, month, day, week);
    } else {
        printf("%d年%d月%d日是星期日\n", year, month, day);
    }
}

int main() {
    int year, month, day;
    scanf("%d/%d/%d", &year, &month, &day);
    printWeekday(year, month, day);
    return 0;
}
